using AutoMapper;
using NSBus.Server.PushNotification;
using Sanelib.DataOperation;
using Sanelib.DataOperation.Impl;
using StructureMap.Configuration.DSL;

namespace NSBus.Server.Initialization
{
    public class NBusServerRegistry : Registry
    {
        public NBusServerRegistry()
        {
            Scan(x =>
            {
                x.TheCallingAssembly();
                x.WithDefaultConventions();
                x.AssemblyContainingType<IMappingEngine>();
            });

            For<IUnitOfWork>().Singleton().HybridHttpOrThreadLocalScoped().Use<UnitOfWork>();

            //For<IUnitOfWork>().Singleton().Use<UnitOfWork>();

            For<IMappingEngine>().Use(ctx => Mapper.Engine);

            For<SignalRService>()
                .Singleton()
                .Use(new SignalRService());
        }
    }
}